<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Login</title>
    <%- include common  %>
</head>
<body>
    <%- include("head",{title:"login",username:''}) %>
    <div class="container-fluid">
        <div class="container">
            <h2 class="text-warning">Welcome To Login </h2>
            <div class="row " style="margin:10px 0;">
                <div class="col-md-4 col-xs-12 col-sm-6">
                <ul class="nav nav-tabs">
                    <li id="lione" role="presentation" class="active"><a onclick="changeShow(true)" >用户名称登录</a></li>
                    <li id="litwo" role="presentation"><a onclick="changeShow(false)"  >手机号码登录</a></li>
                </ul>
            </div>
            </div>
            <div class="row hr">
                <div class="col-md-4 col-xs-12 col-sm-6">
                    <form method="POST" action="/users/signin"  >
                        <div class="form-group" id="usernamebox">
                          <label for="username">用户名称</label>
                          <input type="text" name="username" value="<%- username %>" class="form-control" id="username" placeholder="Enter username">
                        </div>
                        <div class="form-group" id="phonebox">
                            <label for="phone">手机号码</label>
                            <input type="text"  name="phone"  class="form-control" id="phone" placeholder="Enter phone">
                        </div>
                        <div class="form-group">
                            <label for="pass">密码</label>
                            <input type="password"  name="pass"  class="form-control" id="pass" placeholder="Enter password">
                        </div>
                        <button type="submit" class="btn btn-warning">登录</button>
                        <button type="reset" class="btn btn-danger">重置</button>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <script>
        window.onload = function(){
            $("#usernamebox").show()
            $("#phonebox").hide()
        }
        
        function changeShow(flag){
            console.log(flag)

            if(flag){
                $("#usernamebox").show()
                $("#phonebox").hide()
                $("#lione").addClass("active")
                $("#litwo").removeClass("active")

            }else{
                $("#phonebox").show()
                $("#usernamebox").hide()

                $("#litwo").addClass("active")
                $("#lione").removeClass("active")
            }
        }

    </script>

    <%- include foot %>
</body>
</html>